package learn.up.java.designMode.observer.highend;

/**
 *具体的观察者对象，实现更新的方法,是自身状态与目标状态保持一致
 * @author NANUTO
 * @date 2017年11月26日 下午8:32:24
 */
public class ConcreteObserver implements IObserver {
	
	private String observerName;
	
	/**
	 * 观察者状态
	 */
	private String observerState;
	
	private String remindMessage;

	/**
	 * 获取目标的状态更新到观察者zhuangtai
	 */
	@Override
	public void update(AWeatherSubject sub) {
		this.observerState = ((ConcreteSubject) sub).getWeatherContent();
		System.out.println(String.format("[%s] 收到了天气信息：[%s], 记得[%s]", 
				this.getObserverName(), this.observerState, this.getRemindMessage()));
	}

	public String getObserverState() {
		return observerState;
	}

	public void setObserverState(String observerState) {
		this.observerState = observerState;
	}

	@Override
	public void setObserverName(String observerName) {
		this.observerName = observerName;
	}

	@Override
	public String getObserverName() {
		return observerName;
	}

	public String getRemindMessage() {
		return remindMessage;
	}

	public void setRemindMessage(String remindMessage) {
		this.remindMessage = remindMessage;
	}

}
